﻿
using BuildBlock.PipelineBehavior;
using BuildBlock.PipelineBeheviour;
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
namespace Ordering.Application
{
    public static class DependenceInjectionExtension
    {
        public static IServiceCollection AddApplicationService(this IServiceCollection services)
        {
            services.AddMediatR(options =>
            {
                options.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
                options.AddOpenBehavior(typeof(ValidatorBehavior<,>));
                options.AddOpenBehavior(typeof(LoggingBehavior<,>));
               
            });
            return services;
        }
    }
}
